<?php


namespace app\common\cachemodel;


use app\common\model\BaseCache;
use think\Exception;
use traits\model\SoftDelete;

class ZlUserNoComment extends BaseCache
{
    use SoftDelete;
    protected $table = 'wechat_backup_07_18_14_43_00.zl_user_no_comment';
    protected $deleteTime = 'delete_time';

    /**
     * 获取用户是否禁止评论
     * @param int $uid
     * @return bool true 禁止  false 未禁止
     */
    public function getUserIsNoComment(int $uid): bool
    {
        try
        {
            $data = $this->where('uid', $uid)->count();

            return $data ? true : false;
        }
        catch (Exception $e)
        {
            return false;
        }
    }
}
